//package com.feng.oauth2jwt;
//
//import com.feng.oauth2jwt.myauthen.MyJwtTokenStore;
//import com.feng.oauth2jwt.oauth.service.UserService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
//import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
//import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer;
//import org.springframework.security.oauth2.provider.token.DefaultTokenServices;
//import org.springframework.security.oauth2.provider.token.ResourceServerTokenServices;
//import org.springframework.security.oauth2.provider.token.TokenStore;
//import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
//import org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter;
//import org.springframework.security.oauth2.provider.token.store.JwtTokenStore;
//
//@Configuration
//@EnableResourceServer
//public class MyResource extends ResourceServerConfigurerAdapter {
//    @Autowired
//    private DefaultTokenServices defaultTokenServices;
//    @Autowired
//    @Qualifier("ouathUserService")
//    private UserService ouathUserService;
////    @Autowired
////    private ResourceServerTokenServices tokenServices;
//
//    @Override
//    public void configure(ResourceServerSecurityConfigurer config) {
//        config.tokenServices(defaultTokenServices);
//
//    }
//
////    @Bean
////    public TokenStore tokenStore() {
////        return new MyJwtTokenStore(accessTokenConverter());
////    }
//
////    @Bean
////    public JwtAccessTokenConverter accessTokenConverter() {
////        JwtAccessTokenConverter converter = new JwtAccessTokenConverter();
////        converter.setSigningKey(JwtUtils.ssoAppPrivateKey);
////        return converter;
////    }
//
//    @Override
//    public void configure(HttpSecurity http) throws Exception {
////        http.formLogin().and()
////                .requestMatchers()
////                .antMatchers("/login","/oauth/authorize")
////                .and()
////                .authorizeRequests()
////                .anyRequest()
////                .authenticated().and().userDetailsService(ouathUserService).csrf().disable();
////        http.authorizeRequests()
////                .antMatchers("/login","/oauth/authorize").permitAll()
////                .anyRequest().hasAnyRole("ROLE_CLIENT")
////                .and().formLogin()
//////                .successHandler(null).failureHandler(null)
////                .and().logout().permitAll()
////                .and().csrf().disable();
//    }
//
//}